r = 1 gotbat = 1 swampmonster = 1 SCREEN 12 COLOR 7, 0 CLS DIM SHARED DOOM AS DOUBLE Minutes = 10 Seconds = 0 GameTime = Minutes * 60 + Seconds DIM directions(1 TO 8) AS STRING directions(1) = "EAST" directions(2) = "SOUTH OR WEST" directions(3) = "NORTH, SOUTH, OR EAST" directions(4) = "NORTH" directions(5) = "WEST OR SOUTH" directions(6) = "NORTH OR SOUTH" directions(7) = "NORTH OR WEST" directions(8) = "EAST" PRINT "" PRINT "" PRINT "You return home from a hard day at work when you hear someone or something" PRINT "lurking in the darkness. It's as if whatever it is, is lurking in your backyard." PRINT "Do you have what it takes to findout just who or what is lurking back there?" PRINT "" DO: LOOP UNTIL INKEY$ <> "" DOOM = TIMER(0.001) + GameTime 'change this to to desied time for the game to run DO CLS PRINT PRINT PRINT " " PRINT " " PRINT " " PRINT " Night of the Beast " PRINT " " PRINT " Written by " PRINT " " PRINT " D.B. Taylor" PRINT "" PRINT " Copyright (c) 2015" PRINT "" PRINT SPACE$(38); IF INSTR(directions(r), "NORTH") THEN PRINT "N" ELSE PRINT PRINT "*---------------------------------* "; IF INSTR(directions(r), "WEST") THEN PRINT "W"; ELSE PRINT " "; PRINT " + "; IF INSTR(directions(r), "EAST") THEN PRINT "E"; ELSE PRINT " "; PRINT " *------------------------------------*" PRINT SPACE$(38); IF INSTR(directions(r), "SOUTH") THEN PRINT "S" ELSE PRINT PRINT PRINT "If you are stuck just type HELP." PRINT GOSUB ROOM GOSUB parser LOOP ROOM: IF r = 1 THEN: GOSUB r1 IF r = 2 THEN: GOSUB r2 IF r = 3 THEN: GOSUB r3 IF r = 4 THEN: GOSUB r4 IF r = 5 THEN: GOSUB r5 IF r = 6 THEN: GOSUB r6 IF r = 7 THEN: GOSUB r7 IF r = 8 THEN: GOSUB r8 RETURN parser: PRINT "> "; cmd$ = GrabInput cmd$ = LTRIM$(RTRIM$(UCASE$(cmd$))) IF cmd$ = "END" OR cmd$ = "QUIT" OR cmd$ = "EXIT" OR cmd$ = "Q" THEN END END IF IF cmd$ = "HELP" OR cmd$ = "H" OR cmd$ = "?" THEN CLS PRINT "HERE ARE SOME BASIC COMMANDS THAT CAN BE USED IN THE GAME..." PRINT PRINT "NORTH, EAST ,SOUTH, AND WEST - MOVE TO AN AVAILABLE LOCATION" PRINT "EXAMINE (OBJECT) - EXAMINE AN OBJECT" PRINT "USE (OBJECT) - USE AN OBJECT" PRINT "TAKE (OBJECT) - TAKE OR MOVE AN OBJECT" PRINT "INVENTORY - VIEW YOUR INVENTORY" PRINT "DRINK - DRINK BEER" PRINT "UNLOCK - UNLOCK DOOR" PRINT "HELP - VIEW THIS SCREEN" PRINT "END - END GAME" PRINT PRINT "PRESS ANY KEY...": SLEEP DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "INVENTORY" OR cmd$ = "INV" OR cmd$ = "ITEMS" OR cmd$ = "I" THEN CLS PRINT "INVENTORY..." PRINT IF gotbat = 1 THEN: PRINT "A wooden bat from a local sporting goods storee." PRINT PRINT "PRESS ANY KEY..." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "GO NORTH" OR cmd$ = "NORTH" OR cmd$ = "N" THEN IF r = 4 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 2: GOTO moved IF r = 7 THEN: r = 6: GOTO moved IF r = 6 THEN: r = 5: GOTO moved END IF IF cmd$ = "GO EAST" OR cmd$ = "EAST" OR cmd$ = "E" THEN IF r = 1 THEN: r = 2: GOTO moved IF r = 3 THEN: r = 5: GOTO moved IF r = 8 THEN: r = 7: GOTO moved END IF IF cmd$ = "GO SOUTH" OR cmd$ = "SOUTH" OR cmd$ = "S" THEN IF r = 2 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 4: GOTO moved IF r = 5 THEN: r = 6: GOTO moved IF r = 6 THEN: r = 7: GOTO moved END IF IF cmd$ = "GO WEST" OR cmd$ = "WEST" OR cmd$ = "W" THEN IF r = 2 THEN: r = 1: GOTO moved IF r = 5 THEN: r = 3: GOTO moved IF r = 7 THEN: r = 8: GOTO moved END IF IF (cmd$ = "USE BAT") THEN CLS PRINT "You swing it and have the memories of playing ball when you were" PRINT "a kid." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE SWAMP MONSTER") AND r = 8 THEN CLS PRINT "It stands eight feet tall, covered in moss, and trash. A foul smell" PRINT "lingers around him. It's eye's are a bright red and it's mouth is" PRINT "filled with razor sharp teeth." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE BAT") AND gotbat = 1 THEN CLS PRINT "A wooden bat, made from some sweat shop. Bouth for $9.99 at the" PRINT "sporting goods store." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "USE BAT") AND gotbat = 1 AND r = 8 THEN CLS GOTO win: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "RUN AWAY") AND r = 8 THEN CLS GOTO lose: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF moved: RETURN r1: PRINT "You are standing in your backyard. The smell of death lingering" PRINT "in the air." RETURN r2: PRINT "With every step you take, you feel as if you are being watched." RETURN r3: PRINT "You are standing in the back alley which cuts across the swamp." RETURN r4: PRINT "You are standing at what was river bed. But the recent heat wave" PRINT "has dried it up." RETURN r5: PRINT "A strong smell which could only be described as the smell of death" PRINT "lingers in the air. A low growl is heard from the distance." RETURN r6: PRINT "Large weeping widows forge a wall along the muddy path. Whatever is" PRINT "here, it know's that you are upon it's doorstep." RETURN r7: PRINT "You notice a large field of crushed grass, as if whatever it is you" PRINT "are following has made it's nesting grounds here!" RETURN r8: PRINT "The creature emerges from the brush and let's out a mighty scream" PRINT "of anger...what will you do?" RETURN win: COLOR 2, 0 CLS PRINT "As you swing the bat, the monster doesn't move fast enough." PRINT "The bat breaks in two and the monster drops to the ground." PRINT "You return home, not sure of what had just happened. What a" PRINT "way to end a Friday night." PRINT DO: LOOP UNTIL INKEY$ <> "" END lose: COLOR 2, 0 CLS PRINT "You drop the bat and quickly make a break for it. Your heart" PRINT "is pounding a mile a minute and before you know it, you trip" PRINT "and fall into a puddle of merky water. The monster jumps on" PRINT "you on devours your soul." PRINT DO: LOOP UNTIL INKEY$ <> "" END FUNCTION GrabInput$ x = POS(0) y = CSRLIN maxwidth = _WIDTH - x PCOPY 0, 1 'make a backup copy of the screen DO k = _KEYHIT i$ = INKEY$ LOOP UNTIL k = 0 AND INKEY$ = "" 'clear the keyboard buffer DO _LIMIT 30 PCOPY 1, 0 LOCATE y, x: PRINT Userinput$ k = _KEYHIT SELECT CASE k CASE 8 Userinput$ = LEFT$(Userinput$, LEN(Userinput$) - 1) CASE 65 TO 90, 97 TO 122, 32 Userinput$ = UCASE$(Userinput$ + CHR$(k)) END SELECT timerleft## = (DOOM - TIMER(0.001)) minutes = timerleft## \ 60 seconds = timerleft## - minutes * 60 LOCATE 2, 32: PRINT USING " ###:##.###"; minutes, seconds IF timerleft## <= 0 THEN GOTO doomed _DISPLAY LOOP UNTIL k = 13 GrabInput$ = Userinput$ _AUTODISPLAY EXIT FUNCTION doomed: CLS PRINT "The sun rises and the monster runs back into the wild. You lose the" PRINT "chance in witnessing this marvel of evolution. Probably for the better." _DISPLAY END END SUB